function Food(el){
this.el=el
this.len=20
this.foodObj=null
this.foodX=0
this.foodY=0
}
Food.prototype.create=function(){

    let divObj=document.createElement('div')
    divObj.style.width=this.len+'px'
    divObj.style.height=this.len+'px'
    divObj.style.background='red'
    divObj.style.position='absolute'
    this.foodObj=divObj
    this.el.appendChild(divObj)
    this.move()
}

Food.prototype.move=function(){
    let foodXmax=this.el.clientWidth/this.len-1
    let foodYmax=this.el.clientHeight/this.len-1

    this.foodX=Math.floor(Math.random()*(foodXmax+1))*this.len
    this.foodY=Math.floor(Math.random()*(foodYmax+1))*this.len
    this.foodObj.style.left=this.foodX+'px'
    this.foodObj.style.top=this.foodY+'px'
}